package com.huang.core.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {
	private static PropertiesUtil _pro;
	
	public static PropertiesUtil getSingle(){
		if(_pro==null){
			_pro = new PropertiesUtil();
		}
		return _pro;
	}
	
	public String getValue(String key){
		InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("config.properties"); 
		Properties propertyer = new Properties();
		try {
			propertyer.load(inputStream);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return propertyer.getProperty(key);
	}
	
	public static void main(String[] args) {
		PropertiesUtil p = new PropertiesUtil();
		System.out.println(p.getValue("config.db.type"));
	}
}
